package com.atguigu.day21.test02;

import java.io.File;
import java.io.FileFilter;
import java.io.IOException;


/**
 * @author fenge
 */
public class Test02 {
    public static void main(String[] args) throws IOException {
        File checked = new File("D:/testIO/a.txt");
        if (!checked.exists())
            checked.createNewFile();
        System.out.println(checked.getName());
        System.out.println(checked.length());
        System.out.println(checked.getAbsolutePath());
        System.out.println(checked.getParentFile());
        /*if (checked.isFile())
        {
            System.out.println(checked.getName());
            System.out.println(checked.isDirectory());
            System.out.println(checked);
        }*/
        File file = new File("d:/testIO");
        if (file.isFile())
            System.out.println(file.getName()+"是一个文件");
        if (file.isDirectory())
            System.out.println(file.getName()+"是一个文件夹");
        checked.delete();
        File[] child = file.listFiles();
        for (int i = 0; i < child.length; i++) {
            child[i].delete();
        }
        file.delete();
    }
}
